package com.esiag.isidis.fi.pdsTeam.jms.producer;



import javax.jms.JMSException;

import com.esiag.isidis.fi.pdsTeam.send.beans.Information;
import com.esiag.isidis.fi.pdsTeam.annotation.Queue;
import com.esiag.isidis.fi.pdsTeam.jms.connection.AbstractConnectionFactory;
import com.esiag.isidis.fi.pdsTeam.jms.connection.ConnectionActiveMQ;


public class ActiveMQProducer extends AbstractProducerFactory<Information>{

	
	@SuppressWarnings("rawtypes")
	public ActiveMQProducer(Class msgClass) {
		super(msgClass);
	}
	@SuppressWarnings("rawtypes")
	public String getQueue(Class msgClass) {
		@SuppressWarnings("unchecked")
		Queue queue=(Queue) msgClass.getAnnotation(Queue.class);
		if(queue!=null) return queue.value();
		return null;
	}
	
	
	public void send(Information f) throws Exception {
		super.send(f);
	}
	@SuppressWarnings("rawtypes")
	@Override
	public AbstractConnectionFactory getConnection(Class msgClass) throws JMSException {
		return new ConnectionActiveMQ(msgClass);
	}

}
